﻿//-----------------------------------------------------------------------
// <copyright file="MainWindow.xaml.cs" author="Artak Mkrtchyan">
//     Creative Commons - GNU General Public License (http://creativecommons.org/licenses/GPL/2.0/
// </copyright>
// <author>Artak Mkrtchyan</author>
// <email>mkArtak@gmail.com</email>
// <date>20/03/2013</date>

using AppUpdateInstaller.ViewModel;
using ConsoleHoster.Common.Utilities.Threading;
using System.Windows;

namespace AppUpdateInstaller
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window
	{
		private readonly AppUpdateInstallerViewModel viewModel;

		public MainWindow()
			: this(null)
		{
		}

		public MainWindow(string[] args)
		{
			this.viewModel = new AppUpdateInstallerViewModel(new ViewModelDispatcher(this.Dispatcher), args);

			this.DataContext = this.viewModel;

			InitializeComponent();
		}

		private async void Window_Loaded_1(object sender, RoutedEventArgs e)
		{
			await this.viewModel.StartUpdateAsync();
		}
	}
}
